/**
 *泛型方法
 */
class Alg2{
   // public <T extends Comparable<T>> T findMax(T[] array)
    public static<T extends Comparable<T>> T fingMax(T[] array) {
        T max = array[0];
        for (int i = 0; i < array.length; i++) {
            if (max.compareTo(array[i]) < 0) {
                max = array[i];
            }
        }
        return max;
    }

}
public class Ttest {
    public static void main(String[] args) {
        Integer[] array = {1,2,3,4};
        Integer ret = Alg2.<Integer>fingMax(array);
       // Integer ret = Alg2.fingMax(array); 可以省略，这样也是对的
        System.out.println(ret);
    }

}
